import { ReactNode } from 'react'
import { Redirect } from 'umi'
import { useAuth } from '@/hooks'

type Props = {
    children: ReactNode
}

export default (props: Props) => {
    const { isLogin } = useAuth();
    if (isLogin) {
        return <div>{props.children}</div>;
    } else {
        return <Redirect to="/login" />;
    }
}